package com.sniper.web.shiro.filter;

import com.sniper.data.Protocol;
import com.sniper.utils.HttpUtil;
import org.apache.shiro.web.filter.authc.UserFilter;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 * 前台留言登录控制
 * Created by suzhen on 2017/8/2.
 */
public class FrontAuthcFilter extends UserFilter {

    @Override
    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {

        //给url绑定当前url

        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        HttpUtil.setLoginBackUrl(httpServletRequest, Protocol.LOGIN_BACK_URL);

        System.out.println(FrontAuthcFilter.class);

        return super.onAccessDenied(request, response);

    }
}
